package com.lvxh.exp.expmemo.service.impl;

import java.util.List;

import com.lvxh.exp.bean.ExpException;
import com.lvxh.exp.expmemo.dao.holder.Expmemo;
import com.lvxh.exp.expmemo.dao.ExpmemoMapper;
import com.lvxh.exp.expmemo.service.ExpmemoService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("expmemoService")
public class ExpmemoServiceImpl implements ExpmemoService
{
    @Autowired
    private ExpmemoMapper mapper;

    @Override
    public int delete(Expmemo bean)
    {
        return mapper.delete(bean);
    }

    @Override
    public int update(Expmemo bean)
    {
        return mapper.update(bean);
    }

    @Override
    public int insert(Expmemo bean)
    {
        return mapper.insert(bean);
    }

    @Override
    public int getCountOfSummary(Expmemo bean)
    {
        return mapper.getCountOfSummary(bean);
    }

    @Override
    public List<Expmemo> getList(Expmemo bean)
    {
        return mapper.getList(bean);
    }

    @Override
    public List<Expmemo> getListOfSummary(Expmemo bean)
    {
        return mapper.getListOfSummary(bean);
    }

    @Override
    public int delete(List<Expmemo> list)
    {
        for (int i = 0; i < list.size(); i++)
        {
            if (mapper.delete(list.get(i)) < 1)
            {
                new ExpException("del " + list.get(i) + " error");
            }
        }
        return 1;
    }
}
